

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	template="template/template.xhtml" xmlns:p="http://primefaces.org/ui">
	<ui:define name="title">Add taxi manage page</ui:define>

	<ui:define name="menu">
		<ul>
			<li><a href='service.jsf'><span>Service</span></a></li>
			<li class="active"><a href='taxi.jsf'><span>Taxi</span></a></li>
			<li><a href='map-view.jsf'><span>Map</span></a></li>

			<li><a href='customer.jsf'><span>Customer</span></a></li>
			<li><a href='user.jsf'><span>User</span></a></li>

		</ul>
	</ui:define>
	<ui:define name="main-content">
		<center>
			<div style="min-height: 700px;">
				<p:growl id="growl"></p:growl>
				<h1 style="margin-top: 5px; margin-bottom: 10px">Add Taxi</h1>
				<h:form>
					<table align="center"
						style="width: 80%; margin-left: 280px; padding-right: 10px; color: black;">
						<tr>
							<td width="30%">Imei</td>
							<td width="30%"><p:inputText value="#{taxi.taxi.imei}"
									maxlength="15" id="imei" required="true"
									requiredMessage="Please input imei"
									validator="#{taxi.validateImei}">
									<f:ajax event="blur" render="ImeiError"></f:ajax>
								</p:inputText></td>
							<td width="20%"><p:message for="imei" id="ImeiError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Number Plate</td>
							<td><p:inputText value="#{taxi.taxi.numberPlate}"
									maxlength="20" required="true"
									requiredMessage="Please input number Plate" id="numberPlate"
									validator="#{taxi.validateNumberPlate}">
									<f:ajax event="blur" render="plateError"></f:ajax>
								</p:inputText></td>
							<td><p:message for="numberPlate" id="plateError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Number of Seat</td>
							<td><p:inputText value="#{taxi.taxi.numberOfSeat}"
									maxlength="1" required="true"
									requiredMessage="Please input number seat" id="seat"
									validator="#{taxi.validateSeat}">
									<f:ajax event="blur" render="seatError"></f:ajax>
								</p:inputText></td>
							<td><p:message for="seat" id="seatError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Description</td>
							<td><p:inputTextarea value="#{taxi.taxi.description}"
									cols="23" rows="5" id="des" maxlength="500" required="true"
									requiredMessage="Please give description">
									<f:ajax event="blur" render="desError"></f:ajax>
								</p:inputTextarea></td>
							<td><p:message for="des" id="desError" style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Expiration Time</td>
							<td><p:inputMask mask="99/99/9999"
									value="#{taxi.taxi.expirationTime}" required="true"
									id="expireDay" label="Expiration time"
									requiredMessage="Please give expiration time">
									<f:convertDateTime pattern="dd/MM/yyyy" />
									<f:ajax event="blur" render="exError"></f:ajax>
								</p:inputMask></td>
							<td><p:message for="expireDay" id="exError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Display Color</td>
							<td><p:inputText value="#{taxi.taxi.displayColor}"
									id="color" required="true"
									requiredMessage="Please give color code">
									<f:validateLongRange minimum="0" maximum="50"></f:validateLongRange>
									<f:ajax event="blur" render="colorError"></f:ajax>
								</p:inputText></td>
							<td><p:message for="color" id="colorError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Sim Number</td>
							<td><p:inputText value="#{taxi.taxi.simNumber}" id="sim"
									maxlength="11" validator="#{taxi.validateSim}" required="true"
									requiredMessage="Please give Sim number">
									<f:ajax event="blur" render="simError"></f:ajax>
								</p:inputText></td>
							<td><p:message for="sim" id="simError" style="Color: red; "></p:message></td>
						</tr>

						<tr>
							<td>Ip address</td>
							<td><p:inputMask value="#{taxi.taxi.ipAddress}" id="ip"
									mask="999.999.999.999" required="true"
									requiredMessage="Please give ip address">
									<f:ajax event="blur" render="ipError"></f:ajax>
								</p:inputMask></td>
							<td><p:message for="ip" id="ipError" style="Color: red; "></p:message></td>
						</tr>

						<tr>
							<td>Port Listen</td>
							<td><p:inputText value="#{taxi.taxi.portListen}" id="port"
									required="true" requiredMessage="Please input port">
									<f:validateLongRange minimum="1" maximum="10000"></f:validateLongRange>
									<f:ajax event="blur" render="portError"></f:ajax>
								</p:inputText></td>
							<td><p:message for="port" id="portError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Name of driver</td>
							<td><p:inputText value="#{taxi.taxi.driverName}"
									maxlength="100"></p:inputText></td>
							<td></td>
						</tr>
						<tr>
							<td>Phone of driver</td>
							<td><p:inputText value="#{taxi.taxi.driverPhone}"
									maxlength="11"
									validatorMessage="Phone of driver must has from 9 to 11 numbers">
									<f:validateRegex pattern="[0-9]{10}||[0-9]{11}||[0-9]{9}"></f:validateRegex>
									<p:ajax event="blur" update=":growl"></p:ajax>

								</p:inputText></td>
							<td></td>
						</tr>
						<tr>
							<td>Email of driver</td>
							<td><p:inputText value="#{taxi.taxi.driverEmail}" id="email"
									maxlength="200" validatorMessage="Invalid Email">
									<f:ajax event="blur" render="emailError"></f:ajax>
									<f:validateRegex
										pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$"></f:validateRegex>
								</p:inputText></td>
							<td><p:message for="email" id="emailError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Birthday of driver</td>
							<td><p:inputMask mask="99/99/9999"
									value="#{taxi.taxi.driverBirthday}" id="birday">
									<f:convertDateTime pattern="dd/MM/yyyy" />
									<f:ajax event="blur" render="birthError"></f:ajax>
								</p:inputMask></td>
							<td><p:message for="birday" id="birthError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>License Type of driver</td>
							<td><p:inputText value="#{taxi.taxi.driverLicenseType}"
									maxlength="2" id="licenseType" validatorMessage="Invalid Type">
									<f:ajax event="blur" render="typeError"></f:ajax>
									<f:validateRegex pattern="^[A-Z][0-9]$"></f:validateRegex>
								</p:inputText></td>
							<td><p:message for="licenseType" id="typeError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>License Code of driver</td>
							<td><p:inputText value="#{taxi.taxi.driverLicenseCode}"></p:inputText></td>
							<td></td>
						</tr>
						<tr>
							<td>Expire Day of driver</td>
							<td><p:inputMask mask="99/99/9999"
									value="#{taxi.taxi.driverExpireDay}" id="driverday">
									<f:convertDateTime pattern="dd/MM/yyyy" />
									<f:ajax event="blur" render="exdriError"></f:ajax>
								</p:inputMask></td>
							<td><p:message for="driverday" id="exdriError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Shift Number</td>
							<td><p:inputText value="#{taxi.taxi.driverShiftNumber}">
								</p:inputText></td>
							<td></td>
						</tr>
						<tr>
							<td>Start day of driver</td>
							<td><p:inputMask mask="99/99/9999"
									value="#{taxi.taxi.driverDateStart}" id="startday">
									<f:convertDateTime pattern="dd/MM/yyyy" />
									<f:ajax event="blur" render="startdateError"></f:ajax>
								</p:inputMask></td>
							<td><p:message for="startday" id="startdateError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Identity of driver</td>
							<td><p:inputText value="#{taxi.taxi.driverIdentifyNumber}"
									maxlength="9" id="indentity"
									validatorMessage="Invalid Indentity">
									<f:ajax event="blur" render="indenError"></f:ajax>
									<f:validateRegex pattern="[0-9]{9}"></f:validateRegex>
								</p:inputText></td>
							<td><p:message for="indentity" id="indenError"
									style="Color: red; "></p:message></td>
						</tr>
						<tr>
							<td>Active</td>
							<td><p:selectBooleanCheckbox value="#{taxi.taxi.active}"></p:selectBooleanCheckbox>
							</td>
							<td></td>
						</tr>
					</table>
					<br></br>
					<center>
						<p:commandButton action="#{taxi.addTaxi}" ajax="false"
							update=":growl" type="submit" value="Submit">
						</p:commandButton>
						<p:commandButton action="taxi.jsf" ajax="false" value="Cancel"
							style="margin-left: 10px" immediate="true"></p:commandButton>
					</center>
				</h:form>
			</div>
		</center>
	</ui:define>

</ui:composition>










